﻿
using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Profile;


    public partial class admin_product_goods_add02 : System.Web.UI.Page
    {

        // Methods
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (this.txtaInstruction.InnerText.Length > 300)
            {
                base.Response.Write("<script language='javascript'>alert('简介字数不能超过300个！'); </script>");
                return;
            }
            if (base.Request.QueryString["pid"] != null)
            {
                SQLAccess.DoSql("update DB_Shoppro set Instruction='" + this.txtaInstruction.InnerText.Replace("'", "''") + "',  procontent='" + this.txtaContent.InnerText.Replace("'", "''") + "',MobileInstruction='" + this.txtMobileInstiturion.Text.Replace("'", "''") + "' where proid=" + base.Request.QueryString["pid"] + "");
                base.Response.Write("<script language='javascript'>alert('产品详细描述修改成功');window.location.href='goods_add02.aspx?pid=" + base.Request.QueryString["pid"] + "';</script>");
                base.Response.End();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Session["Adminlogin"] == null)
            {
                base.Response.Write("<script language=javascript>window.top.location.href='../login.aspx';</script>");
                base.Response.End();
            }
            this.ImageButton1.Attributes["onclick"] = "return clicka();";
            if (!base.IsPostBack && (base.Request.QueryString["pid"] != null))
            {
                this.upbind();
            }
        }

        private void upbind()
        {
            string sql = "select procontent,isnull(Instruction,'') as Instruction,isnull(MobileInstruction,'') as MobileInstruction from DB_Shoppro where proid=" + base.Request.QueryString["pid"];
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            this.txtaContent.InnerText = table.Rows[0]["procontent"].ToString().Replace("''","'");
            this.txtaInstruction.InnerText = table.Rows[0]["Instruction"].ToString().Replace("''","'");
            this.txtMobileInstiturion.Text = table.Rows[0]["MobileInstruction"].ToString().Replace("''", "'");
        }


    }
